package com.icangya.service.impl;

import com.icangya.DAO.*;
import com.icangya.domain.GoodsConvert;
import com.icangya.domain.GoodsConvertDetails;
import com.icangya.domain.RwGoodOrder;
import com.icangya.service.IGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("GoodsServiceImpl")
public class GoodsServiceImpl implements IGoodsService {

    @Autowired
    private IRwGoodOrderDAO iRwGoodOrderDAO;

    @Autowired
    private IGoodsConvertDAO iGoodsConvertDAO;

    @Autowired
    private IGoodsConvertDetailsDAO iGoodsConvertDetailsDAO;

    @Override
    public Long getUserOrderCountByNow(long uid) {
        return iRwGoodOrderDAO.getUserOrderCountByNow(uid);
    }

    @Override
    public GoodsConvert saveGoodsConvert(GoodsConvert goodsConvert) {
        return iGoodsConvertDAO.get(iGoodsConvertDAO.save(goodsConvert));
    }

    @Override
    public List getGoodsConvertByStatus(long status) {
        return iGoodsConvertDAO.getGoodsConvertByStatus(status);
    }

    @Override
    public GoodsConvert getGoodsConvertById(long id) {
        return iGoodsConvertDAO.get(id);
    }

    @Override
    public Boolean updateGoodsConvert(GoodsConvert goodsConvert) {
        return iGoodsConvertDAO.update(goodsConvert);
    }

    @Override
    public void removeGoodsConvertById(GoodsConvert goodsConvert) {
        iGoodsConvertDAO.remove(goodsConvert);
    }

    @Override
    public GoodsConvertDetails saveGoodsConvertDetails(GoodsConvertDetails goodsConvertDetails) {
        return iGoodsConvertDetailsDAO.get(iGoodsConvertDetailsDAO.save(goodsConvertDetails));
    }

    @Override
    public List getGoodsConvertDetailsByGid(long gid) {
        return iGoodsConvertDetailsDAO.getGoodsConvertDetailsByGid(gid);
    }

    @Override
    public RwGoodOrder saveRwGoodOrder(RwGoodOrder rwGoodOrder) {
        return iRwGoodOrderDAO.get(iRwGoodOrderDAO.save(rwGoodOrder));
    }
}
